#include <iostream>
#include <vector>
using namespace std;

class Solution {
public:
    void duplicateZeros(vector<int>& arr)
    {
        int n = arr.size();
        int left = 0;
        int right = -1;

        while (right < n - 1) {
            if (arr[left] = 0) {
                right += 2;
            }
            else {
                right++;
            }
            left++;
        }
        while (right >= 0)
        {
            arr[right--] = arr[left--];
            if (arr[left] == 0)
                arr[right--] = 0;
        }
    }
};

int main()
{
    return 0;
}